]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Show label when frequent app view is empty.
authorCarlos Soriano <carlos.soriano89@gmail.com>
Fri, 3 May 2013 16:20:21 +0000 (18:20 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 2 Sep 2013 19:25:03 +0000 (21:25 +0200)
Currently we show a empty view, that seems broken, so we add a label
showing that there's not enough frequent applications to show.

https://bugzilla.gnome.org/show_bug.cgi?id=694710

data/theme/gnome-shell.css
js/ui/appDisplay.js

index 8e8b7551cdddb48beb25adee8a3b4370c4fea0ce..8afa98bac79d4c90ad0a8b23031763c0eddbc51a 100644 (file)
@@ -957,6 +957,11 @@ StScrollBar StButton#vhandle:active {
     padding: 0px 30px;
 }
 
+.no-frequent-applications-label {
+    font-size: 18pt;
+    color: #999999;
+}
+
 .app-folder-icon {
     padding: 5px;
 }
index b685dc274974554846800191eba92542238e51ca..e19ad13a7c8de85b2c5c97d390e25b2feb48c114 100644 (file)
@@ -37,6 +37,8 @@ const INACTIVE_GRID_OPACITY = 77;
 const INACTIVE_GRID_OPACITY_ANIMATION_TIME = 0.40;
 const FOLDER_SUBICON_FRACTION = .4;
 
+const MIN_FREQUENT_APPS_COUNT = 3;
+
 const INDICATORS_ANIMATION_TIME = 0.5;
 // 100% means indicators wait for be animated until the previous one
 // is animated completely. 0% means all animators are animated
@@ -570,14 +572,32 @@ const FrequentView = new Lang.Class({
     _init: function() {
         this.parent(null, { fillParent: true });
         this.actor = new St.Widget({ style_class: 'frequent-apps',
+                                     layout_manager: new Clutter.BinLayout(),
                                      x_expand: true, y_expand: true });
+
+        this._noFrequentAppsLabel = new St.Label({ text: _("Frequently used applications will appear here"),
+                                                   style_class: 'no-frequent-applications-label',
+                                                   x_align: Clutter.ActorAlign.CENTER,
+                                                   x_expand: true,
+                                                   y_align: Clutter.ActorAlign.CENTER,
+                                                   y_expand: true });
+
+        this._grid.actor.y_expand = true;
+
         this.actor.add_actor(this._grid.actor);
+        this.actor.add_actor(this._noFrequentAppsLabel);
+        this._noFrequentAppsLabel.hide();
 
         this._usage = Shell.AppUsage.get_default();
     },
 
     loadApps: function() {
         let mostUsed = this._usage.get_most_used ("");
+        let hasUsefulData = mostUsed.length >= MIN_FREQUENT_APPS_COUNT;
+        this._noFrequentAppsLabel.visible = !hasUsefulData;
+        if(!hasUsefulData)
+            return;
+
         for (let i = 0; i < mostUsed.length; i++) {
             if (!mostUsed[i].get_app_info().should_show())
                 continue;